const fs = require('fs');
const { src, dest } = require('');
const stream = () => {
    const readstream = fs.createReadStream('package.json'); //创建读取文件文件流
    const writestream = fs.createWriteStream('a.txt'); //创建写入文件文件流
    readstream.pipe(writestream); //使用pipe，将readstream导入writestream中，可想象为从一个池子向另一个池子里倒水，实现文件复制
    return readstream; //返回一个stream对象。任务可正常开始，正常结束，结束时机为readstream的end事件
};

exports.stream = stream;
